<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>问卷设计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../component/layui/css/layui.css" />
    <link rel="stylesheet" href="../../component/pear/css/pear.css" />
    <script src="../../component/layui/layui.js"></script>
    <script src="../../component/pear/pear.js"></script>
</head>

<body class="pear-container" style="height: 100vh;">
    <div class="layui-card" style="height: 60px;">
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="width: 100px;">
                            <select name="type_name">
                                <option value="">所有选项</option>
                            </select>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-body">
            <table id="ques-table" lay-filter="ques-table"></table>
        </div>
    </div>
</body>
<script type="text/html" id="barDemo">
    <div class="layui-clear-space">
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-xs" lay-event="more">
        更多 
        <i class="layui-icon layui-icon-down"></i>
        </a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="addNewData">新增</button>
        <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
        <button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页数据</button>
        <button class="layui-btn layui-btn-sm" id="dropdownButton">
        下拉按钮
        <i class="layui-icon layui-icon-down layui-font-12"></i>
        </button>
        <button class="layui-btn layui-btn-sm" id="reloadTest">
        重载测试 
        <i class="layui-icon layui-icon-down layui-font-12"></i>
        </button>
        <button class="layui-btn layui-btn-sm layui-btn-primary" id="rowMode">
        <span>{{= d.lineStyle ? '多行' : '单行' }}模式</span>
        <i class="layui-icon layui-icon-down layui-font-12"></i>
        </button>
    </div>
</script>
<script>
    layui.use(['table'], function() {
        var table = layui.table;

        table.render({
            elem: '#ques-table',
            url: '../../admin/data/ques.json',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            page: true,
            cols: [[
                { type: 'checkbox', fixed: 'left' },
                { field: 'id', fixed: 'left', width: 80, title: '编号', sort: true},
                { field: 'catagory', width: 100, title: '问卷类型' },
                { field: 'title', title: '问卷名称' },
                { fixed: 'right', title: '操作', width: 160, toolbar: '#barDemo' }
            ]]
        });

        table.on('toolbar(ques-table)', function(obj) {
            if (obj.event === 'addNewData') {
                layer.open({
                    title: '问卷设计',
                    type: 2,
                    area: ['100%', '100%'],
                    content: '/view/ques/designQues.html'
                });
            }
        });
    })
</script>
</html>